<?php 
require_once 'sesi_login.php';
require_once 'konfigurasi.php';

fungsi('pengguna');

define('PAGE', 'Admin Latihan Detail');
define('SUB_PAGE', 'Admin Latihan Detail');
define('PAGE_ICO', 'icon-stats');
define('PAGE_URL', 'admin_latihan_detail.php');

panggil_header();
koneksi_buka();

$text_q_soal = "select *, a.id as s_id, a.nama as s_nama, b.nama as m_nama, c.nama as k_nama
			from soal a left join materi b on a.materi = b.id 
			left join kelas c on b.tipe_kelas = c.tipe
			where a.id = ".$_GET['id'];
$q_soal = mysql_query($text_q_soal);
$dt_soal = mysql_fetch_array($q_soal);
$jumlah = $dt_soal['jumlah'];

$text_q_soal = "select *, a.no as no_soal from d_soal a left join pilihan b on a.jawaban_pilihan_no = b.no and b.d_soal = a.id
				where soal_id = ".$_GET['id']."";
//				echo $text_q_soal;
$q_d_soal = mysql_query($text_q_soal);

?>

<div class="content">
                
	<div class="page-header">
		<div class="icon">
			<span class="ico-arrow-right"></span>
		</div> 
		<h1> <a href="admin_latihan.php">Admin Latihan</a> &raquo; Detail Latihan<small>SDN I</small></h1>
	</div>


	<div class="row-fluid">
		<div class="span12">                

			<div class="block">
				<div class="head">                                
					<h2>Detail Latihan</h2>
					<ul class="buttons">             
						<li><a href="#" onClick="source('form_pa'); return false;"><div class="icon"><span class="ico-info"></span></div></a></li>
					</ul>                                                                  
				</div> 
				<div class="row-fluid">                            
					<div class="span2">Materi</div>
					<div class="span10"><?php echo $dt_soal['m_nama']?></div>
				</div> 
				<div class="row-fluid">                            
						<div class="span2">Kelas</div>
						<div class="span10"><?php echo $dt_soal['k_nama']?></div>
				</div>                 
				<div class="row-fluid">                            
					<div class="span2">Nama latihan</div>
					<div class="span10"><?php echo $dt_soal['s_nama']?></div>
				</div>    
				<div class="row-fluid">                            
					<div class="span2">Jumlah</div>
					<div class="span10"><?php echo $dt_soal['jumlah']?></div>
				</div>  
				<div class="row-fluid">
					<div class="span2"></div>
					<div class="span10">    
						<!-- <button class="btn btn-primary" type="button">Lihat</button> --> 							
						<button class="btn btn-success" id="btn-ubah" type="button">Ubah</button> 
						<!-- <button class="btn btn-warning" type="button">Batal</button> -->       
					</div>   
				</div>    
			</div>
		</div>  
	</div> 
	
	<div class="row-fluid">
		<div class="span12">
			<div class="block">
				<div class="head purple">
					<div class="icon"><span class="ico-book-3"></span></div>
					<h2>Daftar Soal</h2>
					<ul class="buttons">
						<li><a href="#" onClick="source('table_hover'); return false;"><div class="icon"><span class="ico-info"></span></div></a></li>
					</ul> 
					<ul class="buttons">
						<li><a id="tambah-soal" href="#"><div class="icon"><span class="ico-plus-sign"></span></div></a></li>
					</ul>                      
					                                                         
				</div>                
				<div class="data-fluid">
					<table cellpadding="0" cellspacing="0" width="100%" class="table fpTable lcnp">
						<thead>
							<tr>
								<th width="10%">
									No Soal
								</th>
								<th width="40%">
									Pertanyaan
								</th>
								<th width="40%">
									Jawaban
								</th>
								<th class="TAC" width="10%">
									Operation
								</th>
							</tr>
						</thead>
						<tbody>
							<?php
								while($dt_d_soal = mysql_fetch_array($q_d_soal)){
									
							?>
								<tr>
									<td>
										<?php echo $dt_d_soal['no_soal'];?>
									</td>
									<td>
										<?php echo $dt_d_soal['pertanyaan'];?>
									</td>
									<td>
										<?php echo $dt_d_soal['nama'];?>
									</td>
									<td>
										<a href="#" class="button green">
											<div class="icon"><span class="ico-pencil"></span></div>
										</a>
										<a href="#" class="button red">
											<div class="icon"><span class="ico-remove"></span></div>
										</a>                                              
									</td>
								</tr>
							<?php
								}
							?>
						</tbody>
					</table>
				</div>  
				<br />
				<div class="data-fluid">
					<div align="right">                  
						<button class="btn btn-primary" type="button">Cetak Semua</button>
					</div>   
				</div> 
							 
			</div>
		</div>
	</div>
</div>

<div id="dialog-tambah-soal" style="display:none;">
	<?php
		require_once 'modul/admin_latihan/tambah_soal.php';
	?>
</div>

<div id="input-tambah-pilihan" style="display:none;">
	<div class="row-form">
		<div id="pilihan-text" class="span3"></div>
		<div class="span9"><input type="text" placeholder="pilihan jawaban"/></div>
	</div> 
</div>

<div class="dialog" id="source" style="display: none;" title="Source"></div>

<?php
panggil_footer();
?>
